<template>
  <div></div>
</template>
<script>
import { getPublicKey } from "@/api/dataCrawl/wepoker.js";
export default {
  data() {
    return {};
  },
  mounted() {
    this.getPublicKey();
  },
  methods: {
    // 随机生成一个32位的字符串，包含数字跟小写字母
    getDeviceId() {
      let deviceId = "";
      for (let i = 0; i < 32; i++) {
        let randomNum = Math.floor(Math.random() * 62);
        if (randomNum < 10) {
          deviceId += randomNum;
        } else if (randomNum < 36) {
          deviceId += String.fromCharCode(randomNum - 10 + 97);
        } else {
          deviceId += String.fromCharCode(randomNum - 36 + 65);
        }
      }
      return deviceId;
    },
    // 获取公钥
    getPublicKey() {
      let params = {
        version: "5.7",
        lang: "cn",
        deviceId: this.getDeviceId(),
        idfa: "0",
        platform: "h5",
        channel: "0",
        sign: "",
      };
      getPublicKey(params).then((res) => {
        console.log(111, resize);
      });
    },
  },
};
</script>